def isAnagram(str1, str2): # DO NOT modify this line 
    # TODO: add your code here
    return sorted(str1) == sorted(str2)

# DO NOT modify the code below 
def main():
    s1 = input()
    s2 = input()
    print(1 if isAnagram(s1, s2) else 0)
    
if __name__ == '__main__':
    main()
# DO NOT modify the code above 
